using Serilog;

namespace Universal.Api.Configs;

public static class SerilogConfig
{
    public static void Configure(WebApplicationBuilder builder)
    {
        Serilog.Debugging.SelfLog.Enable(msg => Console.WriteLine("SERILOG SELFLOG: " + msg));

        // 只保留控制台输出，不写入文件
        Log.Logger = new LoggerConfiguration()
            .ReadFrom.Configuration(builder.Configuration)
            .WriteTo.Console()
            .CreateLogger();

        builder.Host.UseSerilog();
    }
}